<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:o="http://openfaces.org/"
      xmlns:comp="http://facelets.mycomponents.com">
<h:head>
    <title>ScrumApp</title>
    <link type="text/css" rel="stylesheet" href="resources/css/style.css" />
    <link type="text/css" rel="stylesheet" href="resources/css/theme.css"/>
    <link type="text/css" rel="stylesheet" href="resources/css/primefacesSkin.css"/>
    <script type="JavaScript" src="scripts/handleDialogComplete.js"></script>
</h:head>

<h:body>
    <f:view locale="#{Language.locale}">
        <f:loadBundle basename="resources.messages.Messages" var="msgBundle"/>
        <div id="container">
            <div id="header">
                <h2>ScrumApp</h2>
                <div id="topmenu">
                    <ul>
                        <li class="current"><a href="/ScrumApp/faces/Project.xhtml">#{msgBundle.project}</a></li>
                        <li><a href="/ScrumApp/faces/ProductBacklog.xhtml">#{msgBundle.product_backlog}</a></li>
                        <li><a href="/ScrumApp/faces/SprintBacklog.xhtml">#{msgBundle.sprint_backlog}</a></li>
                        <li><a href="/ScrumApp/faces/SprintList.xhtml">#{msgBundle.sprint_list}</a></li>
                        <li><a href="/ScrumApp/faces/Impediments.xhtml">#{msgBundle.impediments}</a></li>
                        <li><a href="/ScrumApp/faces/People.xhtml">#{msgBundle.people}</a></li>
                        <li><a href="/ScrumApp/faces/Charts.xhtml">#{msgBundle.charts}</a></li>
                        <li><a href="/ScrumApp/faces/Taskboard.xhtml">Task Board</a></li>
                    </ul>
                </div>
            </div>
            <div id="top-panel">
                <comp:chooseProject id="chooseProject" />
            </div>

            <div id="content">
                <h:form id="projectForm" styleClass="form" >
                    <div class="infobox" >
                        <h3>
                            <h:outputText value="#{msgBundle.project}" />
                            <p:commandLink oncomplete="createDialog.show();" value="#{msgBundle.new_project}" styleClass="add" type="button" />
                        </h3>
                        <h2><h:outputText value="#{projectBean.project.projectName}" /></h2>
                        <table style="height:205px; margin-left: 5px" >
                                <tr>
                                    <td style="text-align: left; width: 180px" ><h:outputText value="#{msgBundle.current_sprint}:" /></td>
                                    <td><h:outputText value="#{projectBean.currentSprint.sprintNumber} / #{projectBean.numberOfSprint}"/></td>
                                </tr>
                                <tr>
                                    <td style="text-align: left"><h:outputText value="#{msgBundle.objective}:"/></td>
                                    <td><h:outputText value="#{projectBean.currentSprint.objective}"/></td>
                                </tr>
                                <tr>
                                    <td style="text-align: left"><h:outputText value="#{msgBundle.days_to_end}"/></td>
                                    <td><h:outputText value="#{projectBean.daysToFinishSprint}"/></td>
                                </tr>
                                <tr>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <h:commandButton styleClass="button" value="#{msgBundle.edit}" onclick="editDialog.show();" type="button"/>
                                        <h:commandButton styleClass="button" value="#{msgBundle.delete}" onclick="deleteDialog.show();" type="button"/>
                                    </td>
                                </tr>
                        </table>
                    </div>

                    <div class="infobox">
                        <h3><h:outputText value="#{msgBundle.sprint_burndown_chart}" /></h3>
                        <table style="height: 250px">
                            <tr>
                                <td>
                                    <o:chart model="#{chartBean.currentSprintBurndownChart}" width="355" height="247" >
                                        <o:lineChartView shapesVisible="false" colors="#d9e6f0, #375b91">
                                            <o:categoryAxis domain="key" position="up_90" style="font-size: 7pt;" />
                                        </o:lineChartView>
                                    </o:chart>

                                </td>
                            </tr>
                        </table>
                    </div>
                </h:form>
                <h:form prependId="false" styleClass="form">
                        <p:dialog header="#{msgBundle.create_project}" widgetVar="createDialog" modal="true"
                                  resizable="false" draggable="true" width="350" >
                            <table width="100%" style="height: 100px; text-align: left" id="createPanel">
                                <tr>
                                    <td><h:outputText value="#{msgBundle.project_name}: *" /></td>
                                    <td><h:inputText maxlength="30" id="txtCreatProjectName" value="#{projectBean.newproject.projectName}" required="true" /></td>
                                </tr>
                                <tr align="center" >
                                    <td colspan="2">
                                        <p:commandButton value="#{msgBundle.submit}" style=" margin-top: 10px; font-weight: bold"
                                                         action="#{projectBean.submitCreate}"  oncomplete="createDialogComplete(xhr, status, args)" />
                                    &nbsp;<p:commandButton value="#{msgBundle.cancel}" style=" margin-top: 10px; font-weight: bold"
                                                           onclick="createDialog.hide()" /></td>
                                </tr>
                            </table>
                        </p:dialog>
                </h:form>
                <h:form prependId="false" styleClass="form">
                        <p:dialog header="#{msgBundle.edit_project}" widgetVar="editDialog" modal="true" resizable="false" draggable="true"  width="350" >
                            <table width="100%" style="height: 100px; text-align: left" id="editPanel">
                                <tr>
                                    <td><h:outputText value="#{msgBundle.project_name}: *" /></td>
                                    <td><h:inputText maxlength="30" id="txtEditProject" value="#{projectBean.editproject.projectName}" required="true" /></td>
                                </tr>
                                <tr align="center" >
                                    <td colspan="2" >
                                        <p:commandButton value="#{msgBundle.submit}" style=" margin-top: 10px; font-weight: bold"
                                                         action="#{projectBean.submitEdit}"  oncomplete="editDialogComplete(xhr, status, args)" />
                                    &nbsp;<p:commandButton value="#{msgBundle.cancel}" style=" margin-top: 10px; font-weight: bold"
                                                           onclick="editDialog.hide()" /></td>
                                </tr>
                            </table>
                        </p:dialog>
                </h:form>
                <h:form prependId="false" styleClass="form">
                        <p:dialog header="#{msgBundle.delete_project}" widgetVar="deleteDialog" modal="true" resizable="false" draggable="true"  width="450">
                            <table width="100%" style="height: 100px; text-align: left" id="deletePanel">
                                <tr>
                                    <td colspan="2" ><h:outputText value="#{msgBundle.are_you_sure_project} '#{projectBean.project.projectName}'?" /></td></tr>
                                <tr>
                                    <td align="right" >
                                        <p:commandButton value="#{msgBundle.yes}" style=" font-weight: bold"
                                                         action="#{projectBean.submitDelete}" oncomplete="deleteDialog.hide()"  /></td>
                                    <td><p:commandButton value="#{msgBundle.no}" style=" font-weight: bold"
                                                         onclick="deleteDialog.hide()"/></td></tr>
                            </table>
                        </p:dialog>
                    </h:form>
                </div>
                <div id="footer">
                    <div id="credits">Template based on another by <a href="http://www.bloganje.com">Bloganje</a>
                </div>
                <br />
            </div>
        </div>
    </f:view>
</h:body>
</html>
